package com.mi.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mi.system.dto.query.DeptQueryDTO;
import com.mi.system.entity.Dept;
import com.mi.system.vo.DeptTreeVO;
import com.mi.system.vo.DeptVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Dept mapper
 *
 * @author jin_huaquan
 * @version 1.0
 * @date 2021/11/1 13:47
 */
@Mapper
public interface DeptMapper extends BaseMapper<Dept> {

    /**
     * list dept
     *
     * @param page  page info
     * @param query query params
     * @return dept list
     */
    Page<DeptVO> selectByPage(Page page, @Param("query") DeptQueryDTO query);

    /**
     * list dept
     *
     * @param query query params
     * @return dept list
     */
    List<DeptVO> selectByQuery(@Param("query") DeptQueryDTO query);

    /**
     * list child dept
     *
     * @param parentId parent id
     * @return dept list
     */
    List<DeptTreeVO> selectByParentId(@Param("parentId") Long parentId);
}
